New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

feathers-hooks

Package Overview
Dependencies
Maintainers
3
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

feathers-hooks

Before and after service method call hooks for easy authorization and processing.

  • 1.8.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.5K
increased by39.53%
Maintainers
3
Weekly downloads
 
Created
Source

Feathers Hooks

Build Status Code Climate Test Coverage Dependency Status Download Status Slack Status

Middleware for Feathers service methods

Documentation

Please refer to the Feathers hooks documentation for more details on:

  • The philosophy behind hooks
  • How you can use hooks
  • How you can chain hooks using Promises
  • Params that are available in hooks
  • Hooks that are bundled with feathers and feathers plugins

Quick start

feathers-hooks allows to register composable middleware functions when a Feathers service method executes. This makes it easy to decouple things like authorization and pre- or post processing and error handling from your service logic.

To install from npm, run:

$ npm install feathers-hooks --save

Then, to use the plugin in your Feathers app:

const feathers = require('feathers');
const hooks = require('feathers-hooks');

const app = feathers().configure(hooks());

Then, you can register a hook for a service:

// User service
const service = require('feathers-memory');

module.exports = function(){
  const app = this;

  let myHook = function(options) {
    return 
  }

  // Initialize our service
  app.use('/users', service());

  // Get our initialize service to that we can bind hooks
  const userService = app.service('/users');

  // Set up our before hook
  userService.hooks({
    before(hook){
      console.log('My custom before hook ran!');
    }
  });
}

License

Copyright (c) 2016 Feathers contributors

Licensed under the MIT license.

Keywords

FAQs

Package last updated on 02 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc